<?php
/**
 * 
 * Form Create Supporter
 * @package Form
 * @filesource /application/forms
 * @author chinhpv.hp
 *
 */
class Form_CreateSupporter extends Zend_Form
{
	private $formDecorators;
	private $elementDecorators;
	private $buttonDecorators;
	private $hiddenDecorators;
	
	/**
	 * 
	 * Constructor set id and class for form
	 * @param string $id
	 * @param string $class
	 */
	
    
    public function __construct($id= "", $class = "")
    {
    	$this->formDecorators = array(
    								array('FormElements'),
    								array('Form',array("name"=>$id, "class"=>$class))
    							);
    						
    	$this->elementDecorators = array(
    									array('Label', array()), 
    									array("HTMLTag",array("tag"=>"div","class"=>"row")),
    									array("Description",array("tag"=>"span"))
    								);
    	$this->buttonDecorators = array(
										array('ViewHelper'),
										array("HTMLTag",array("tag"=>"div","class"=>"buttons"))
										
									);
									
		$this->hiddenDecorators = array(
    									
    									array("HTMLTag",array("tag"=>"div")),
    									array("Description",array("tag"=>"span"))
    								);					
    	//add decorator for form
        $this->addDecorators($this->formDecorators);
        $this->setName('frmAESupporter');
        
        //a dd textbox name=name
        $txtUsername = $this->createElement("text", "name")
        				->setLabel("Tên supporter:")
        				->setRequired(TRUE)
        				->setAttrib("size", 40)
        				->setValidators(array(new Zend_Validate_StringLength(array(8,15))))
        				->setOptions(array('autocomplete'=> 'off'))
        				->addDecorators($this->elementDecorators);
        $this->addElement($txtUsername);
        
        
        //add textbox name=email
        $txtEmail = $this->createElement("text", "email")
       					 ->setLabel("Email:")
       					 ->addFilters(
       						 array(new Zend_Filter_StringTrim(), new Zend_Filter_StringToLower()))
        				 ->setAttrib("size", 40)
       					 ->addDecorators($this->elementDecorators);
        $this->addElement($txtEmail);
        
        //add textbox name = mobile
        $txtMobile = $this->createElement("text", "phone")
       					 ->setLabel("Phone:")
        				 ->setAttrib("size", 40)
       					 ->addDecorators($this->elementDecorators);
        $this->addElement($txtMobile);
        
        //add dropdown list name='yahoo'
        $txtYahoo = $this->createElement("text", "yahoo");
        $txtYahoo->setLabel("Yahoo:");
        $txtYahoo->setRequired(true)->setAttrib("size", 40);
        
        $txtYahoo->addDecorators($this->elementDecorators);
        $this->addElement($txtYahoo);
        //add dropdownlist type
        $slcType = $this->createElement('select', 'type')
        				->setLabel("Hỗ trợ:")
        				->setOptions(array("style" => "width: 200px;"))
        				->addMultiOptions(array(0 => "Bán hàng", 1 => "Kỹ thuật"))
        				->addDecorators($this->elementDecorators);
        $this->addElement($slcType);
        //add submit
        $btnSubmit = $this->createElement('submit', 'submit')
        					->setLabel('Lưu')
        					->setOptions(array('class' =>'button'));
        $this->addElement($btnSubmit);
        $btnReset = $this->createElement('reset', 'reset')
        					->setLabel('Làm lại')
        					->setOptions(array('class' =>'button'));
        $this->addElement($btnReset);

    }
	
}
?>